﻿using ChineseSchool.BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ChineseSchool.Admin
{
    public partial class ucTopRankUser : System.Web.UI.UserControl
    {
        private B_User userServices = new B_User();


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindTopUser();
            }
        }

        private void BindTopUser()
        {
            var lstTopUser = userServices.GetTopUser();
            rptTopUser.DataSource = lstTopUser;
            rptTopUser.DataBind();
        }

        protected void rptTopUserItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var imgAvatar = (Image)e.Item.FindControl("imgAvatar");
            if (string.IsNullOrEmpty(imgAvatar.ImageUrl))
            {
                imgAvatar.ImageUrl = "/images/noavatar.png";
            }
        }
    }
}